package com.sctvcloud.bazhong.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;


import com.ruihang.generalibrary.ui.adapter.BaseHolderAbsAdapter;
import com.ruihang.generalibrary.ui.util.OnItemInternalClick;
import com.sctvcloud.bazhong.R;
import com.sctvcloud.bazhong.beans.Branch;
import com.sctvcloud.bazhong.beans.FRebellion;
import com.sctvcloud.bazhong.ui.adapter.holder.BaseBranchHolder;
import com.sctvcloud.bazhong.ui.adapter.holder.DepartHolder;

import java.util.List;

/**
 * Created by Administrator on 2017/6/26 0026.
 */

public class DepartAdapter extends BaseHolderAbsAdapter<Branch, BaseBranchHolder> implements OnItemInternalClick {
    private OnItemInternalClick onItemInternalClick;
    private OnVideoClickListener mListener;

    public DepartAdapter(Context context, List<Branch> list) {
        super(context, list);
    }

    @Override
    public BaseBranchHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        BaseBranchHolder rebllionHolder;
        LayoutInflater inflater = LayoutInflater.from(context);
        rebllionHolder = new DepartHolder(context, inflater.inflate(R.layout.item_depart, parent, false));
        rebllionHolder.setInternalClick(this);
        return rebllionHolder;
    }


    @Override
    public void onItemInternalClick(View itemView, View view, int position) {
        if (onItemInternalClick != null) {
            onItemInternalClick.onItemInternalClick(itemView, view, position);
        }
    }

    @Override
    public DepartAdapter setItemInternalClick(OnItemInternalClick itemInternalClick) {
        this.onItemInternalClick = itemInternalClick;
        return this;
    }

    public void setOnVideoClickListener(OnVideoClickListener listener) {
        mListener = listener;
    }

    public interface OnVideoClickListener {
        void onVideoClick(View view, View coverImgView, FRebellion fRebellion);
    }
}
